package model

import (
	"gorm.io/gorm"
	"time"
)

type EduCourse struct {
	ID              int            `json:"id"`
	TeacherID       int            `json:"teacherId"`
	SubjectID       int            `json:"subjectId"`
	SubjectParentID int            `json:"subjectParentId"`
	Title           string         `json:"title"`
	Price           int            `json:"price"`
	LessonNum       int            `json:"lessonNum"`
	Cover           string         `json:"cover"`
	BuyCount        int            `json:"buy_count"`
	ViewCount       int            `json:"view_count"`
	Version         int            `json:"version"`
	Status          string         `json:"status"`
	Sort            int            `json:"sort"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
	DeletedAt       gorm.DeletedAt `gorm:"index" json:"deleted_at"`

	Description EduCourseDescription `json:"Description"`
	Chapters    []EduChapter         `gorm:"foreignKey:CourseID;references:ID"`
}

func (EduCourse) TableName() string {
	return "edu_course"
}
